﻿using ViewMaker;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Windows.Input;
using System.Collections.ObjectModel;
using ViewMaker.Core.Controls;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel;
using System.Collections.Generic;
using ViewMaker.Core.Utils;
using System.Windows.Controls;
using System.Windows;

namespace ViewMaker.Core.Tests
{
    [TestClass()]
    public class ViewUtilTest
    {
        [TestMethod()]
        public void テストViewModelコンテンツ作成()
        {
            var content = (ContentControl)ViewUtil.BuildContent(new TestViewModel());
#if !SILVERLIGHT
            Assert.AreEqual("TestViewModel", ((Panel)((Panel)((ContentControl)content.Content).Content)).Name);
#else
            Assert.AreEqual("TestViewModel", ((Panel)((ContentControl)((StackPanel)((ScrollViewer)content.Content).Content).Children[0]).Content).Name);
#endif
        }

        [TestMethod()]
        public void 名前なしでコンテンツ作成()
        {
            var content = (ContentControl)ViewUtil.BuildContent(new TestClass());
#if !SILVERLIGHT
            Assert.AreEqual("", ((Panel)(((Grid)((ContentControl)content.Content).Content).Children[0])).Name);
#else
            Assert.AreEqual("", ((Panel)((Grid)((ContentControl)((StackPanel)((ScrollViewer)content.Content).Content).Children[0]).Content).Children[0]).Name);
#endif
        }

        [TestMethod()]
        public void サンプルViewModelコンテンツ作成()
        {
            var content = (ContentControl)ViewUtil.BuildContent(new SampleViewModel());
            Assert.IsNotNull(content);
        }


    }
}
